package com.cheifsteam.springframework.aop.aspectj;

import com.cheifsteam.springframework.aop.Pointcut;
import com.cheifsteam.springframework.aop.PointcutAdvisor;
import org.aopalliance.aop.Advice;

/**
 * @author qrx
 * @date 2025/8/6 14:22
 * @description: TODO
 */
public class AspectJExpressionPointcutAdvisor implements PointcutAdvisor {

    //切点
    private AspectJExpressionPointcut pointcut;

    //具体拦截方法
    private Advice advice;

    //表达式
    private String expression;


    public void setExpression(String expression) {
        this.expression = expression;
    }

    @Override
    public Advice getAdvice() {
        return advice;
    }

    @Override
    public Pointcut getPointCut() {
        if (pointcut==null)
        {
            pointcut = new AspectJExpressionPointcut(expression);
        }
        return pointcut;
    }

    public void setAdvice(Advice advice) {
        this.advice = advice;
    }
}
